package com.hczt.xhminiapp.db.entity;

import lombok.Data;
import org.springframework.data.domain.Sort;

import javax.persistence.*;
import java.util.Date;

/**
 * OAuth 客户端实体类
 */
@Data
@Entity
@Table(name = "oauth_client_details")
public class OauthClientDetails {
    @Id
    private String  clientId;
    private String  clientName;
    private String  resourceIds;
    private String  clientSecret;
    private String  scope;
    private String  authorizedGrantTypes;
    private String  webServerRedirectUri;
    private String  authorities;
    private Long    accessTokenValidity;
    private Long    refreshTokenValidity;
    private String  additionalInformation;
    private String  autoapprove;
    private Date    updateTime;
    private Date    createTime;

    @PrePersist
    public void prePersist() {
        createTime = new Date();
        updateTime = new Date();
    }

    @PreUpdate
    public void PreUpdate() {
        updateTime = new Date();
    }

    public static Sort defaultSort = new Sort(Sort.Direction.DESC, "updateTime", "createTime");

}
